﻿<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" 
                   assembly="WebPattern.Core" 
                   namespace="WebPattern.Core">
  
  <class name="Role" table="Security_Roles" batch-size="0" lazy="true">
    
    <cache region="users" usage="nonstrict-read-write" />
    
    <id name="Id" column="RoleId" unsaved-value="0">
      <generator class="native"/>
    </id>
    
    <property name="Name" column="RoleName" />
    <property name="ApplicationName" column="ApplicationName"/>
    <property name="Description" column="Description" />
    <property name="Enabled" column="Enabled"/>

    <set name="UsersInRole" table="Security_UsersInRoles">
      <key column="RoleId" not-null="true" unique="true" />
      <many-to-many column="UserId" class="User" />
    </set>
  </class>
</hibernate-mapping>